#include "bits/stdc++.h"
using namespace std;

int n,k,ans=0,sum=0;
int sn[30] = {0};
int dt[30] = {0};

void dfs(int v,int pos){
	if(v == k+1){
		if(sum % 2 != 0) ans++;
		return ;
	}
	for(int i = pos+1;i <= n;i++){
		if(sn[i] == 1) continue;
		sn[i] = 1;
		sum += dt[i];
		dfs(v+1,i);
		sum -= dt[i];
		sn[i] = 0; 
	}
}
int main(){
	cin >> n >>k;
	for(int i=1;i<=n;i++){
		int m;
		cin >> m;
		dt[i] = m;
	}
	dfs(1,0);
	cout << ans;
	return 0;
}
